Class Comm

java.lang.Object
es.csic.iiia.fabregues.dip.comm.Comm

public class Comm
extends java.lang.Object
Deals with high level communication (String[]) from the DAIDE language
Author:
Angela Fabregues, IIIA-CSIC, fabregues@iiia.csic.es
  • Constructor Summary

    Constructors 
    Constructor Description
    Comm​(IComm commImpl, Observer client)
    Communication.
  • Method Summary

    Modifier and Type Method Description
    int getBuildTimeLimit()
    Returns the deadline for build phases (WIN) in milliseconds.
    GameState getGameState()  
    int getMoveTimeLimit()
    Returns the deadline for move phases (SPR and FAL) in milliseconds.
    int getRetreatTimeLimit()
    Returns the deadline for retreat phases (SUM and AUT) in milliseconds.
    void handleReceivedMessage​(java.lang.String[] message)
    Receives a message from the game manager
    void restart​(java.lang.String powerName, java.lang.String passcode)
    Reconnecting to a game as the player with the following powerName and passcode
    void sendMessage​(java.lang.String[] msg)
    Sends a message to the game manager
    void start()
    Connecting to a new game as either a player or an observer
    void stop()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Comm

      public Comm​(IComm commImpl, Observer client)
      Communication. Notice that an IComm like DaideComm is necessary to stablish communication.
      Parameters:
      game - manager ip
      game - manager port
      client - name
      client - reference
      Throws:
      CommException
      java.io.IOException
  • Method Details

    • start

      public void start() throws CommException
      Connecting to a new game as either a player or an observer
      Throws:
      CommException
      StartingCommException
    • restart

      public void restart​(java.lang.String powerName, java.lang.String passcode) throws CommException
      Reconnecting to a game as the player with the following powerName and passcode
      Parameters:
      powerName -
      passcode -
      Throws:
      CommException
    • sendMessage

      public void sendMessage​(java.lang.String[] msg) throws CommException
      Sends a message to the game manager
      Parameters:
      msg -
      Throws:
      CommException
    • handleReceivedMessage

      public void handleReceivedMessage​(java.lang.String[] message)
      Receives a message from the game manager
    • stop

      public void stop()
    • getGameState

      public GameState getGameState()
    • getMoveTimeLimit

      public int getMoveTimeLimit()
      Returns the deadline for move phases (SPR and FAL) in milliseconds.
    • getRetreatTimeLimit

      public int getRetreatTimeLimit()
      Returns the deadline for retreat phases (SUM and AUT) in milliseconds.
    • getBuildTimeLimit

      public int getBuildTimeLimit()
      Returns the deadline for build phases (WIN) in milliseconds.